package lumis.portal.webfilereplication;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lumis.portal.event.persistence.PortalEventEntityListener;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

/**
 * Custom property of a web file replication type.
 * 
 * @version $Revision: 13093 $ $Date: 2011-05-28 18:40:18 -0300 (Sat, 28 May 2011) $
 * @since 6.0.0
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "lum_WFRProperty")
@GenericGenerator(name = "portal-guid", strategy = "lumis.portal.dao.hibernate.GuidGenerator")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@EntityListeners(value = PortalEventEntityListener.class)
public class WebFileReplicationProperty implements Serializable
{
	@Id
	@GeneratedValue(generator = "portal-guid")
	private String id;

	private String name;

	private String dataType;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type", nullable = false)
	private WebFileReplicationType type;

	/**
	 * Returns the identifier of the property.
	 * 
	 * @return the identifier of the property.
	 * @since 6.0.0
	 */
	public String getId()
	{
		return id;
	}

	/**
	 * Returns the name of the property.
	 * 
	 * @return the name of the property.
	 * @since 6.0.0
	 */
	public String getName()
	{
		return name;
	}

	/**
	 * Defines the name of the property.
	 * 
	 * @param name
	 *            the name to be defined.
	 * @since 6.0.0
	 */
	void setName(String name)
	{
		this.name = name;
	}

	/**
	 * Returns the data type of the property.
	 * 
	 * @return the data type of the property.
	 * @since 6.0.0
	 */
	public String getDataType()
	{
		return dataType;
	}

	/**
	 * Defines the data type of the property.
	 * 
	 * @param dataType
	 *            the data type to be defined.
	 * @since 6.0.0
	 */
	void setDataType(String dataType)
	{
		this.dataType = dataType;
	}

	/**
	 * Returns the web file replication type that owns the property.
	 * 
	 * @return the web file replication type that owns the property.
	 * @since 6.0.0
	 */
	public WebFileReplicationType getType()
	{
		return type;
	}

	/**
	 * Defines the web file replication type that owns the property.
	 * 
	 * @param type
	 *            the web file replication type to be defined.
	 * @since 6.0.0
	 */
	void setType(WebFileReplicationType type)
	{
		this.type = type;
	}
}
